﻿using System.Collections.Generic;
using System.Data.Entity;
using WeBlog.Models;

namespace WeBlog.DataContext
{
    public class WeBlogDbInitializer : CreateDatabaseIfNotExists<WeBlogContext>
    {
        protected override void Seed(WeBlogContext context)
        {                                    
            new List<Widget>{                
                new Widget { Name = "Search", Column = 1, Row = 1, Title = "Search", ShowTitle = true },
                new Widget { Name = "Tags", Column = 1, Row = 2, Title = "Tags", ShowTitle = true },
                new Widget { Name = "Categories", Column = 1, Row = 3, Title = "Categories", ShowTitle = true },
                new Widget { Name = "FeaturedPosts", Column = 1, Row = 4, Title = "Featured Posts", ShowTitle = true }
            }.ForEach( x => context.WidgetSettings.Add(x));            
        }
    }
}
